Page({
  data: {
    origin: "",
    destination: "",
    air_code: "",
    timeType: "",
    startDate: "",
    endDate: "",
    timeSlot: "",
    typeDate: "日期"
  },
  bindDate: function () {
    wx.navigateTo({
      url: "pages/date/date"
    })
  },
  bindBeginCityView: function () {
    wx.navigateTo({
      url: 'pages/citys/citys?cityType=begin',
    })
  },
  bindEndCityView: function () {
    wx.navigateTo({
      url: 'pages/citys/citys?cityType=end',
    })
  },
  airCodeTap: function (e) {
    this.setData({
      air_code: e.detail.value
    })
  },
  searchTrip: function () {
    var that = this;
    //判断是否选择日期
    if (that.data.timeType == '' || that.data.startDate == '' || that.data.endDate == '') {
      wx.showModal({
        title: '提示',
        content: '请选择具体日期段!',
        showCancel: false,
        success: function (res) { }
      });
      return false;
    }
    //判断是否输入始发地或目的地或航班号
    if (that.data.origin == '' && that.data.destination == '' && that.data.air_code == '') {
      wx.showModal({
        title: '提示',
        content: '请输入始发地或目的地或航班号!',
        showCancel: false,
        success: function (res) { }
      });
      return false;
    }
    wx.navigateTo({
      url: '../trip/trip?origin=' + that.data.origin + '&destination=' + that.data.destination + '&air_code=' + that.data.air_code + '&timeType=' + that.data.timeType + '&startDate=' + that.data.startDate + '&endDate=' + that.data.endDate
    })
  }
})